#include <pluginui/manager/spi/StandardSystemTrayMenuManager.h>

namespace antu
{
namespace plugin
{
namespace ui
{
StandardSystemTrayMenuManager::StandardSystemTrayMenuManager(QMenu* pContextMenu)
    : AbstractMenuManager(),
      m_pContextMenu(pContextMenu)
{
    Q_ASSERT(this->m_pContextMenu != nullptr);

    this->m_oMainMenuSections.insert(pair<QString, QMenu*>("fileMenu", m_pContextMenu));
}

bool StandardSystemTrayMenuManager::hasMenus()
{
    return this->m_oMainMenuSections.size() > 1;
}

QMenu *StandardSystemTrayMenuManager::createMenu(const QString &name, const QString &title, const QIcon &icon)
{
    QMenu* pMenu = new QMenu(this->m_pContextMenu);
    pMenu->setObjectName(name);
    pMenu->setTitle(title);

    if (!icon.isNull())
    {
        pMenu->setIcon(icon);
    }
    return pMenu;
}

}
}
}
